<template>
  <a-menu
    theme="dark"
    mode="inline"
    :selected-keys="selectedKeys"
    :open-keys="openKeys"
    @click="onMenuClick"
    @openChange="onOpenChange"
  >
    <a-menu-item key="/console/dashboard">
      <a-icon type="dashboard" />
      <span>仪表盘</span>
    </a-menu-item>
    <a-sub-menu key="product">
      <span slot="title">
        <a-icon type="appstore" />
        <span>产品管理</span>
      </span>
      <a-menu-item key="/console/product/list">
        列表展示
      </a-menu-item>
      <a-menu-item key="/console/product/module">
        模型管理
      </a-menu-item>
      <a-menu-item key="/console/product/rule">
        规则库管理
      </a-menu-item>
    </a-sub-menu>
    <a-sub-menu key="endpoint">
      <span slot="title">
        <a-icon type="apartment" />
        <span>终端管理</span>
      </span>
      <a-menu-item key="/console/endpoint/list">
        列表展示
      </a-menu-item>
    </a-sub-menu>
    <a-sub-menu key="device">
      <span slot="title">
        <a-icon type="api" />
        <span>设备管理</span>
      </span>
      <a-menu-item key="/console/device/list">
        列表展示
      </a-menu-item>
    </a-sub-menu>
    <a-menu-item key="/console/subscribe">
      <a-icon type="pushpin" />
      <span>数据订阅</span>
    </a-menu-item>
    <a-sub-menu key="mock-debug">
      <span slot="title">
        <a-icon type="bug" />
        <span>模拟测试</span>
      </span>
      <a-menu-item key="/console/mock-debug/list">
        列表展示
      </a-menu-item>
    </a-sub-menu>
    <a-sub-menu key="log">
      <span slot="title">
        <a-icon type="history" />
        <span>日志管理</span>
      </span>
      <a-menu-item key="/console/log/list">
        列表展示
      </a-menu-item>
    </a-sub-menu>
  </a-menu>
</template>
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'

import MenuBarMixin from './menu-bar.mixin'

@Component
export default class ConsoleMenu extends Mixins(MenuBarMixin) {
  private created () {
    this.pathKeys = {
      '/console/product/list': 'product',
      '/console/product/module': 'product',
      '/console/product/rule': 'product',
      '/console/endpoint/list': 'endpoint',
      '/console/device/list': 'device',
      '/console/mock-debug/list': 'mock-debug',
      '/console/log/list': 'log'
    }
  }
}
</script>
